package com.colin.app.activity.coordinator;

import com.colin.app.R;
import com.colin.app.app.AppActivity;
import com.colin.app.app.BaseModelImpl;
import com.colin.app.fragment.example.ExampleFragment;
import com.colin.library.other.Constants;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import static com.colin.library.other.Constants.FRAGMENT_ID_COORDINATOR_METHOD;
import static com.colin.library.other.Constants.FRAGMENT_ID_COORDINATOR_OTHER;
import static com.colin.library.other.Constants.FRAGMENT_ID_COORDINATOR_SENIOR;
import static com.colin.library.other.Constants.FRAGMENT_ID_COORDINATOR_VIEW;
import static com.colin.library.other.Constants.FRAGMENT_ID_MAIN_DEMO;
import static com.colin.library.other.Constants.FRAGMENT_ID_MAIN_HOME;
import static com.colin.library.other.Constants.FRAGMENT_ID_MAIN_MINE;
import static com.colin.library.other.Constants.FRAGMENT_ID_MAIN_PERMISSION;

/**
 * Created by Colin on 2017/1/15.
 */

public class CoordinatorTabLayoutModelImpl extends BaseModelImpl implements CoordinatorTabLayoutContract.CoordinatorTabLayoutModel {

    private int position = 0;
    private int layoutType = Constants.FRAGMENT_RECYCLER_VIEW_TYPE_LIST ;
    private List<ExampleFragment > exampleFragmentList = null;

    @Override
    public List<Integer> getFragmentIDList() {
        List<Integer> idList = new ArrayList<>();
        idList.add(FRAGMENT_ID_MAIN_HOME);
        idList.add(FRAGMENT_ID_MAIN_DEMO);
        idList.add(FRAGMENT_ID_MAIN_PERMISSION);
        idList.add(FRAGMENT_ID_MAIN_MINE);
        return idList;
    }
    @Override
    public List<String> getFragmentTitleList() {
        return Arrays.asList(Constants.FRAGMENT_COORDINATOR_TITLE);
    }



    @Override
    public List<ExampleFragment> getFragmentList(AppActivity mAppActivity) {
        if (null==exampleFragmentList||exampleFragmentList.isEmpty()){
            exampleFragmentList = new ArrayList<>();
            exampleFragmentList.add(ExampleFragment.newInstance(mAppActivity, FRAGMENT_ID_COORDINATOR_VIEW));
            exampleFragmentList.add(ExampleFragment.newInstance(mAppActivity, FRAGMENT_ID_COORDINATOR_METHOD));
            exampleFragmentList.add(ExampleFragment.newInstance(mAppActivity, FRAGMENT_ID_COORDINATOR_SENIOR));
            exampleFragmentList.add(ExampleFragment.newInstance(mAppActivity, FRAGMENT_ID_COORDINATOR_OTHER));
        }
        return exampleFragmentList;
    }
    @Override
    public int getPosition() {
        return position;
    }

    @Override
    public void setPosition(int position) {
        this.position = position ;
    }

    @Override
    public int[] getImageHead() {
        return new int[]{
                R.mipmap.tsp_login_bg,
                R.mipmap.ic_launcher,
                R.mipmap.tsp_login_bg,
                R.mipmap.ic_launcher
        };
    }

    @Override
    public int[] getColorArray(AppActivity mAppActivity) {
        return new int[]{
                android.R.color.holo_blue_light,
                android.R.color.holo_red_light,
                android.R.color.holo_orange_light,
                android.R.color.holo_green_light
        };
    }

    @Override
    public int getLayoutType() {
        return layoutType;
    }

    @Override
    public void setLayoutType(int layoutType) {
        this.layoutType = layoutType ;
    }
}
